<div class="wrapper wrapper-content fadeInRight" ng-controller="adminCtr">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>用户列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-12 pull-left">
                            <form class="form-inline">
                                <div class="form-group">
                                    <select class="form-control" ng-options="auth.id as auth.name for auth in data.authList" ng-model="data.search.auth_id"></select>
                                </div>
                                <div class="form-group">
                                    <input class="form-control" ng-model="data.search.keyword" placeholder="姓名或账号关键字">
                                </div>
                                <button class="btn btn-primary no-margins" ng-click="getList(1)">搜索</button>
                                <button class="btn btn-success pull-right" access="AdminAdd" ng-click="edit()">添加
                                </button>
                            </form>
                        </div>
                    </div>
                    <table class="table table-bordered table-hover" style="text-align:center;">
                        <thead>
                        <tr>
                            <td>序号</td>
                            <td>姓名</td>
                            <td>账号</td>
                            <td>角色</td>
                            <td>状态</td>
                            <td>添加时间</td>
                            <td>操作</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="item in data.list">
                            <td>{{getItemIndex($index, data.search.page, data.search.pageSize)}}</td>
                            <td>{{item.true_name}}</td>
                            <td>{{item.name}}</td>
                            <td>{{item.id == 1 ? '系统管理员' : getAuthName(item.auth_id)}}</td>
                            <td>{{item.status == 1 ? '正常' : '禁用'}}</td>
                            <td>{{item.create_time}}</td>
                            <td>
                                <a ng-if="item.id != 1" access="AdminAdd" ng-click="edit(item)">编辑</a>
                                <a ng-if="item.id != 1" access="AdminDel" ng-click="del(item)">删除</a>
                            </td>
                        </tr>
                        <tr no-data="data.list"></tr>
                        </tbody>
                    </table>
                    <div admin-page="data.pages" curr-page="data.search.page" datas-count="data.count"
                         callback="getList"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="1" role="dialog" data-backdrop="static">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">编辑用户</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="editForm">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">角色<span style="color:red;">*</span></label>
                            <div class="col-sm-8">
                                <select class="form-control" ng-model="data.edit.auth_id" required="required"
                                        ng-options="auth.id as auth.name for auth in data.authList">
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">头像</label>
                            <div class="col-sm-8">
                                <upload-img ng-if="data.viewImg" img-path="data.edit.cover"
                                            fixed-wh="200|200"></upload-img>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">姓名<span style="color:red;">*</span></label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="username" ng-model="data.edit.true_name"
                                       required="required">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">账号<span style="color:red;">*</span></label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="name" ng-model="data.edit.name"
                                       required="required">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">密码<span ng-if="!data.edit.id"
                                                                            style="color:red;">*</span></label>
                            <div class="col-sm-8">
                                <input class="form-control" ng-if="!data.edit.id" type="password" name="password"
                                       ng-model="data.edit.password" minlength="6" maxlength="12" required="true">
                                <input class="form-control" ng-if="data.edit.id" type="password" name="password"
                                       ng-model="data.edit.password" minlength="6" maxlength="12">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">状态</label>
                            <div class="col-sm-8">
                                <label>正常
                                    <input type="radio" name="status" ng-model="data.edit.status" value="1">
                                </label>
                                <label>
                                    禁用
                                    <input type="radio" name="status" ng-model="data.edit.status" value="0">
                                </label>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-defualt" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" ng-click="commit()" access="AdminAdd">保存</button>
                </div>
            </div>
        </div>
    </div>


</div>